  !include "MUI2.nsh"

  Name "Diamond Girl"
  OutFile "a.exe"
  InstallDir "$PROGRAMFILES\Diamond Girl"

; Request application privileges for Windows Vista
  RequestExecutionLevel user

;  !define MUI_WELCOMEFINISHPAGE_BITMAP "Panel.bmp"
  !define MUI_HEADERIMAGE
  !define MUI_HEADERIMAGE_BITMAP "themes\default\gfx\logo-win32installer.bmp"

  !define MUI_COMPONENTSPAGE_NODESC

;--------------------------------

; Pages

  !insertmacro MUI_PAGE_LICENSE "LICENSE"
  !insertmacro MUI_PAGE_COMPONENTS
  Var StartMenuFolder
  !insertmacro MUI_PAGE_STARTMENU "Application" $StartMenuFolder
  !insertmacro MUI_PAGE_DIRECTORY
  !insertmacro MUI_PAGE_INSTFILES
  !insertmacro MUI_PAGE_FINISH

  !insertmacro MUI_UNPAGE_CONFIRM
  !insertmacro MUI_UNPAGE_INSTFILES
  !insertmacro MUI_UNPAGE_FINISH

  !insertmacro MUI_LANGUAGE "English"

;--------------------------------

; The stuff to install
Section "!Diamond Girl"

  ; Set output path to the installation directory.
  SetOutPath $INSTDIR
  
  File /r *.*
  
  ; Write the installation path into the registry
  WriteRegStr HKCU "SOFTWARE\Diamond_Girl" "Install_Dir" "$INSTDIR"
  
  ; Write the uninstall keys for Windows
  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Diamond_Girl" "DisplayName" "Diamond Girl"
  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Diamond_Girl" "UninstallString" '"$INSTDIR\uninstall.exe"'
  WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Diamond_Girl" "NoModify" 1
  WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Diamond_Girl" "NoRepair" 1
  WriteUninstaller "uninstall.exe"
  
SectionEnd


;--------------------------------

; Uninstaller

Section "Uninstall"
  
  ; Remove registry keys
  DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Diamond_Girl"
  DeleteRegKey HKCU "SOFTWARE\Diamond_Girl"

  ; Remove installed files
  Delete   "$INSTDIR\Changelog"
  Delete   "$INSTDIR\CREDITS"
  RMDir /r "$INSTDIR\data"
  Delete   "$INSTDIR\diamond_girl.exe"
  Delete   "$INSTDIR\diamond_girl-win32.nsi"
  Delete   "$INSTDIR\LICENSE"
  RMDir /r "$INSTDIR\maps"
  Delete   "$INSTDIR\README"
  Delete   "$INSTDIR\README.settings"
  Delete   "$INSTDIR\README.sfx"
  RMDir /r "$INSTDIR\themes"
  Delete   "$INSTDIR\uninstall.exe"
  Delete   "$INSTDIR\Welcome.txt"
  RMDir /r "$INSTDIR\ui"
  ; Libraries:
  Delete   "$INSTDIR\OpenAL32.dll"
  Delete   "$INSTDIR\SDL.dll"
  Delete   "$INSTDIR\SDL_image.dll"
  Delete   "$INSTDIR\glew32.dll"
  Delete   "$INSTDIR\libFLAC-8.dll"
  Delete   "$INSTDIR\libSDL_gfx-15.dll"
  Delete   "$INSTDIR\libbz2-1.dll"
  Delete   "$INSTDIR\libgcc_s_sjlj-1.dll"
  Delete   "$INSTDIR\libjpeg-62.dll"
  Delete   "$INSTDIR\libjson-c-2.dll"
  Delete   "$INSTDIR\libmikmod-3.dll"
  Delete   "$INSTDIR\libogg-0.dll"
  Delete   "$INSTDIR\libpng16-16.dll"
  Delete   "$INSTDIR\libsndfile-1.dll"
  Delete   "$INSTDIR\libtiff-5.dll"
  Delete   "$INSTDIR\libvorbis-0.dll"
  Delete   "$INSTDIR\libvorbisenc-2.dll"
  Delete   "$INSTDIR\libvorbisfile-3.dll"
  Delete   "$INSTDIR\zlib1.dll"

  RMDir "$INSTDIR"

SectionEnd
